package com.crealth.model;

import java.io.Serializable;
import java.sql.Timestamp;

import com.alibaba.fastjson.JSONObject;

public class WeekPlanModel implements Serializable {
	private static final long serialVersionUID = 2821L;
	private long id;  // 周计划
	private int userID;
	private int week;  //一年中的 第几周
	private int planSqjs;  //申请件数
	private int planFkjs;  //放款件数
	private int planFkje;  //放款金额
	private int planJhcs;  //计划创收
	private int planSqkh;  //申请客户
	private String keyPointConsumerIDs;  // 重点跟进客户
	private Timestamp planTm;  // 提交计划的时间
	
	private int weekMeetCnt;  //本周约谈
	private String meetConuserIDs;  //  约谈的客户id
	private int weekSignedCnt;  // 本周签约
	private String signedConuserIDs;  //  签约的客户id
	private int weekExtendLoanCnt;  // 本周放款
	private String extendConuserIDs;  //  放款的客户id
	
	public WeekPlanModel() {
		planSqjs = 0;
		planFkjs = 0;
		planFkje = 0;
		planJhcs = 0;
		planSqkh = 0;
		weekMeetCnt = 0;
		weekSignedCnt = 0;
		weekExtendLoanCnt = 0;
		keyPointConsumerIDs = "";
		meetConuserIDs = "";
		signedConuserIDs = "";
		extendConuserIDs = "";
		planTm = null;
	}

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public int getUserID() {
		return userID;
	}
	public void setUserID(int userID) {
		this.userID = userID;
	}
	public int getWeek() {
		return week;
	}
	public void setWeek(int week) {
		this.week = week;
	}
	public int getPlanSqjs() {
		return planSqjs;
	}
	public void setPlanSqjs(int planSqj) {
		this.planSqjs = planSqj;
	}
	public int getPlanFkjs() {
		return planFkjs;
	}
	public void setPlanFkjs(int planFkjs) {
		this.planFkjs = planFkjs;
	}
	public int getPlanFkje() {
		return planFkje;
	}
	public void setPlanFkje(int planFkje) {
		this.planFkje = planFkje;
	}	
	public int getPlanJhcs() {
		return planJhcs;
	}
	public void setPlanJhcs(int planJhcs) {
		this.planJhcs = planJhcs;
	}
	public int getPlanSqkh() {
		return planSqkh;
	}
	public void setPlanSqkh(int planSqkh) {
		this.planSqkh = planSqkh;
	}
	public int getWeekMeetCnt() {
		return weekMeetCnt;
	}
	public void setWeekMeetCnt(int weekMeetCnt) {
		this.weekMeetCnt = weekMeetCnt;
	}
	public int getWeekSignedCnt() {
		return weekSignedCnt;
	}
	public void setWeekSignedCnt(int weekSignedCnt) {
		this.weekSignedCnt = weekSignedCnt;
	}
	public int getWeekExtendLoanCnt() {
		return weekExtendLoanCnt;
	}
	public void setWeekExtendLoanCnt(int weekExtendLoanCnt) {
		this.weekExtendLoanCnt = weekExtendLoanCnt;
	}
	public String getKeyPointConsumerIDs() {
		return keyPointConsumerIDs;
	}
	public void setKeyPointConsumerIDs(String keyPointConsumerIDs) {
		this.keyPointConsumerIDs = keyPointConsumerIDs;
	}	
	public String getMeetConuserIDs() {
		return meetConuserIDs;
	}
	public void setMeetConuserIDs(String meetConuserIDs) {
		this.meetConuserIDs = meetConuserIDs;
	}
	public String getSignedConuserIDs() {
		return signedConuserIDs;
	}
	public void setSignedConuserIDs(String signedConuserIDs) {
		this.signedConuserIDs = signedConuserIDs;
	}
	public String getExtendConuserIDs() {
		return extendConuserIDs;
	}
	public void setExtendConuserIDs(String extendConuserIDs) {
		this.extendConuserIDs = extendConuserIDs;
	}	
	public Timestamp getPlanTm() {
		return planTm;
	}
	public void setPlanTm(Timestamp planTm) {
		this.planTm = planTm;
	}

	public JSONObject toJSONObject() {
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("id", id);
		jsonObj.put("userID", userID);
		jsonObj.put("week", week);
		jsonObj.put("planSqjs", planSqjs);
		jsonObj.put("planFkjs", planFkjs);
		jsonObj.put("planFkje", planFkje);
		jsonObj.put("planJhcs", planJhcs);
		jsonObj.put("planSqkh", planSqkh);
		jsonObj.put("keyPointIDs", keyPointConsumerIDs);
		if (planTm != null) {
			jsonObj.put("planTm", planTm.getTime() / 1000);
		}
		
		jsonObj.put("weekMeetCnt", weekMeetCnt);
		jsonObj.put("weekSignedCnt", weekSignedCnt);
		jsonObj.put("weekExtendLoanCnt", weekExtendLoanCnt);
		if (this.signedConuserIDs != null) {
			jsonObj.put("signedConuserIDs", signedConuserIDs);
		}
		if (this.extendConuserIDs != null) {
			jsonObj.put("extendConuserIDs", extendConuserIDs);
		}
		
		return jsonObj;
	}

	public void parseFromJson(JSONObject resJson) {
		if (resJson.containsKey("planSqjs")) {
			planSqjs = resJson.getIntValue("planSqjs");
		}
		if (resJson.containsKey("planFkjs")) {
			planFkjs = resJson.getIntValue("planFkjs");
		}
		if (resJson.containsKey("planFkje")) {
			planFkje = resJson.getIntValue("planFkje");
		}
		if (resJson.containsKey("planJhcs")) {
			planJhcs = resJson.getIntValue("planJhcs");
		}
		if (resJson.containsKey("planSqkh")) {
			planSqkh = resJson.getIntValue("planSqkh");
		}
		if (resJson.containsKey("keyPointIDs")) {
			keyPointConsumerIDs = resJson.getString("keyPointIDs");
		}		
	}
		
}
